<?php

/**
 * @author HX<titanrain@163.com>
 */
class UserIdentity extends CUserIdentity
{
	public function authenticate()
	{
        return true;
		$sql = 'select user_id,user_pic,disk_size,disk_used from ccs8_user ' .
				'where user_name=:uname and password=:upass and is_legal=1';
				
		$cmd = DBUtil::cmd($sql);
		$cmd->bindParam(":uname",$this->username,PDO::PARAM_STR);
		
		$cmd->bindParam(":upass",md5($this->password),PDO::PARAM_STR);
		$user = $cmd->queryRow();
		
		if(!$user){
			return false;
		} else {
			//save user in session
			$this->setState('user_id', $user['user_id']);
			$this->setState('user_pic', $user['user_pic']);
			$this->setState('disk_size', $user['disk_size']);
			$this->setState('disk_used', $user['disk_used']);
			return true;
		}
	}
}
